

public class State implements Comparable<State> {

	public String name;
	public int seats = 1;
	private double priority;
	private double population;

	public State(String name, double population) {
		this.name = name;
		this.population = population;
		calPriority();
	}
	
	public void calPriority() {
		priority = population / Math.sqrt((double)seats*((double)seats+1));
	}

	@Override
	public int compareTo(State otherState) {
		
		if (this.priority < otherState.priority) {
			return 1;
		}

		if (this.priority > otherState.priority) {
			return -1;
		}

		return 0;
	}

	@Override
	public String toString() {
		return "State [name=" + name + ", seats=" + seats + ", priority="
				+ priority + ", population=" + population + "]";
	}

}
